<h1>Listing bugs</h1>

<table>
  <tr>
  <% for column in Bug.content_columns %>
    <th><%= column.human_name %></th>
  <% end %>
    <th>User</th>
    <th>System</th>
  </tr>
  
<% i = 0 %>
<% for bug in @bugs %>  
  <% i+=1%>
  <tr class="row<%=i%2+1%>">
  <% for column in Bug.content_columns %>
    <td><%=h bug.send(column.name) %></td>
  <% end %>
    <td><%= bug.user.name %></td>
    <td><%= bug.system.name %></td>
    <td><%= link_to 'Show', :action => 'show', :id => bug %></td>
    <% if @current_user.type.to_s == 'UserDeveloper' %>
    <td><%= link_to 'Edit', :action => 'edit', :id => bug %></td>
    <% end %>
  </tr>
<% end %>
</table>

<%= link_to 'Previous page', { :page => @bug_pages.current.previous } if @bug_pages.current.previous %>
<%= link_to 'Next page', { :page => @bug_pages.current.next } if @bug_pages.current.next %> 

<br />

<%= link_to 'New bug', :action => 'new' %>
